class PurchaseEvaluationItem {
  String? id;
  String? projectId;
  String? projectName;
  String? assessmentContent;
  String? evaluationCriteria;
  num? weightScore;
  String? templateName;
  String? deptName;

  PurchaseEvaluationItem({
    this.id,
    this.projectId,
    this.projectName,
    this.assessmentContent,
    this.evaluationCriteria,
    this.weightScore,
    this.templateName,
    this.deptName,
  });

  PurchaseEvaluationItem copyWith({
    String? id,
    String? projectId,
  }) {
    return new PurchaseEvaluationItem(
      id: id ?? this.id,
      projectId: projectId ?? this.projectId,
    );
  }

  @override
  String toString() {
    return '''PurchaseEvaluationItem{
      id: id,
      projectId: projectId,
    }''';
  }

  @override
  bool operator ==(Object other) =>
      identical(this, other) ||
      (other is PurchaseEvaluationItem &&
          runtimeType == other.runtimeType &&
          id == other.id &&
          projectId == other.projectId);

  factory PurchaseEvaluationItem.fromMap(Map<String, dynamic> map) {
    return new PurchaseEvaluationItem(
      id: map['id'] != false ? map['id'].toString() as String? : "",
      projectId: map['project_id'][0] != false
          ? map['project_id'][0].toString() as String?
          : "",
      projectName: map['project_id'][1] != false
          ? map['project_id'][1].toString() as String?
          : "",
      assessmentContent: map['assessment_content'] != false
          ? map['assessment_content'].toString() as String?
          : "",
      evaluationCriteria: map['evaluation_criteria'] != false
          ? map['evaluation_criteria'].toString() as String?
          : "",
      weightScore: map['weight_score'] != false ? map['weight_score'] : null,
    );
  }

  Map<String, dynamic> toMap() {
    // ignore: unnecessary_cast
    return {
      'id': this.id,
      'projectId': this.projectId,
    } as Map<String, dynamic>;
  }

  List toDomainList() {
    List list = [
      if (this.projectId != null && this.projectId != '')
        ['project_id', '=', int.parse(this.projectId!)],
    ] as List;
    // if (list.length == 0) {
    //   list.add(['id', '!=', null]);
    // }
    // ignore: unnecessary_cast
    return list;
  }

  Map<String, dynamic> toOdooMap() {
    // ignore: unnecessary_cast
    return {
      'id': this.id,
      'project_id': int.parse(this.projectId!),
      'assessment_content': this.assessmentContent,
      'weight_score': this.weightScore,
      'evaluation_criteria': this.evaluationCriteria,
    } as Map<String, dynamic>;
  }

//</editor-fold>

}
